home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1998 March / Pc Users extra 6.iso / pshare95 / prog / formula1 / vcform1.z / Grouping.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-09-09  |  9.1 KB  |  287 lines

  1. VERSION 5.00
  2. Begin VB.Form Grouping 
  3.    Caption         =   "Report Wizard"
  4.    ClientHeight    =   4665
  5.    ClientLeft      =   60
  6.    ClientTop       =   405
  7.    ClientWidth     =   6465
  8.    Icon            =   "Grouping.frx":0000
  9.    LinkTopic       =   "Form1"
  10.    MaxButton       =   0   'False
  11.    MinButton       =   0   'False
  12.    ScaleHeight     =   4665
  13.    ScaleWidth      =   6465
  14.    StartUpPosition =   2  'CenterScreen
  15.    Begin VB.CommandButton Command2 
  16.       Caption         =   "h"
  17.       BeginProperty Font 
  18.          Name            =   "Wingdings 3"
  19.          Size            =   8.25
  20.          Charset         =   2
  21.          Weight          =   700
  22.          Underline       =   0   'False
  23.          Italic          =   0   'False
  24.          Strikethrough   =   0   'False
  25.       EndProperty
  26.       Height          =   255
  27.       Left            =   2295
  28.       TabIndex        =   13
  29.       Top             =   2040
  30.       Width           =   495
  31.    End
  32.    Begin VB.CommandButton Command1 
  33.       Caption         =   "i"
  34.       BeginProperty Font 
  35.          Name            =   "Wingdings 3"
  36.          Size            =   8.25
  37.          Charset         =   2
  38.          Weight          =   700
  39.          Underline       =   0   'False
  40.          Italic          =   0   'False
  41.          Strikethrough   =   0   'False
  42.       EndProperty
  43.       Height          =   255
  44.       Left            =   2310
  45.       TabIndex        =   12
  46.       Top             =   2625
  47.       Width           =   495
  48.    End
  49.    Begin VB.CommandButton btnGetField 
  50.       Caption         =   ">"
  51.       BeginProperty Font 
  52.          Name            =   "MS Sans Serif"
  53.          Size            =   8.25
  54.          Charset         =   0
  55.          Weight          =   700
  56.          Underline       =   0   'False
  57.          Italic          =   0   'False
  58.          Strikethrough   =   0   'False
  59.       EndProperty
  60.       Height          =   255
  61.       Left            =   2295
  62.       TabIndex        =   11
  63.       Top             =   900
  64.       Width           =   495
  65.    End
  66.    Begin VB.CommandButton btnRemoveField 
  67.       Caption         =   "<"
  68.       BeginProperty Font 
  69.          Name            =   "MS Sans Serif"
  70.          Size            =   8.25
  71.          Charset         =   0
  72.          Weight          =   700
  73.          Underline       =   0   'False
  74.          Italic          =   0   'False
  75.          Strikethrough   =   0   'False
  76.       EndProperty
  77.       Height          =   255
  78.       Left            =   2280
  79.       TabIndex        =   10
  80.       Top             =   1290
  81.       Width           =   495
  82.    End
  83.    Begin VB.TextBox txtFields 
  84.       Appearance      =   0  'Flat
  85.       Height          =   3135
  86.       Left            =   3120
  87.       MultiLine       =   -1  'True
  88.       TabIndex        =   8
  89.       Top             =   360
  90.       Width           =   3015
  91.    End
  92.    Begin VB.TextBox txtGroup 
  93.       Appearance      =   0  'Flat
  94.       ForeColor       =   &H00FF0000&
  95.       Height          =   240
  96.       Index           =   0
  97.       Left            =   3120
  98.       TabIndex        =   9
  99.       Top             =   360
  100.       Visible         =   0   'False
  101.       Width           =   3015
  102.    End
  103.    Begin VB.TextBox Text2 
  104.       Height          =   3375
  105.       Left            =   3000
  106.       TabIndex        =   7
  107.       Top             =   240
  108.       Width           =   3255
  109.    End
  110.    Begin VB.CommandButton btnCancel 
  111.       Cancel          =   -1  'True
  112.       Caption         =   "Cancel"
  113.       Height          =   375
  114.       Left            =   1800
  115.       TabIndex        =   6
  116.       Top             =   4200
  117.       Width           =   975
  118.    End
  119.    Begin VB.CommandButton btnBack 
  120.       Caption         =   "< &Back"
  121.       Height          =   375
  122.       Left            =   2985
  123.       TabIndex        =   5
  124.       Top             =   4200
  125.       Width           =   975
  126.    End
  127.    Begin VB.CommandButton btnNext 
  128.       Caption         =   "&Next >"
  129.       Height          =   375
  130.       Left            =   3975
  131.       TabIndex        =   4
  132.       Top             =   4200
  133.       Width           =   975
  134.    End
  135.    Begin VB.CommandButton btnFinish 
  136.       Caption         =   "&Finish"
  137.       Height          =   375
  138.       Left            =   5160
  139.       TabIndex        =   3
  140.       Top             =   4200
  141.       Width           =   975
  142.    End
  143.    Begin VB.TextBox Text1 
  144.       BackColor       =   &H80000003&
  145.       Height          =   3615
  146.       Left            =   2880
  147.       TabIndex        =   2
  148.       Top             =   120
  149.       Width           =   3495
  150.    End
  151.    Begin VB.ListBox lstFields 
  152.       Height          =   2205
  153.       Left            =   120
  154.       TabIndex        =   1
  155.       Top             =   720
  156.       Width           =   2070
  157.    End
  158.    Begin VB.Line Line4 
  159.       BorderColor     =   &H80000005&
  160.       X1              =   105
  161.       X2              =   6345
  162.       Y1              =   3975
  163.       Y2              =   3975
  164.    End
  165.    Begin VB.Line Line3 
  166.       BorderColor     =   &H80000003&
  167.       X1              =   105
  168.       X2              =   6345
  169.       Y1              =   3960
  170.       Y2              =   3960
  171.    End
  172.    Begin VB.Label Label2 
  173.       Caption         =   "Priority"
  174.       Height          =   240
  175.       Left            =   2310
  176.       TabIndex        =   14
  177.       Top             =   2355
  178.       Width           =   555
  179.    End
  180.    Begin VB.Label Label1 
  181.       Caption         =   "Do you want to add any grouping levels?"
  182.       Height          =   495
  183.       Left            =   120
  184.       TabIndex        =   0
  185.       Top             =   120
  186.       Width           =   2415
  187.    End
  188. Attribute VB_Name = "Grouping"
  189. Attribute VB_GlobalNameSpace = False
  190. Attribute VB_Creatable = False
  191. Attribute VB_PredeclaredId = True
  192. Attribute VB_Exposed = False
  193. Dim NumGroups As Integer
  194. Private Sub btnGetField_Click()
  195.     Call AddGroup
  196. End Sub
  197. Private Sub btnNext_Click()
  198.     Grouping.Hide
  199.     Sorting.Show 1
  200. End Sub
  201. Private Sub btnRemoveField_Click()
  202.     Dim x As Integer
  203.     Dim RemovedGroup As Integer
  204.     Dim Found As Boolean
  205.     Found = False
  206.     For x = 0 To NumGroups - 1
  207.         If txtGroup(x).FontBold = True Then
  208.             Found = True
  209.             RemovedGroup = x
  210.         End If
  211.         If Found Then
  212.             If x < NumGroups - 1 Then
  213.                 txtGroup(x).Text = txtGroup(x + 1).Text
  214.             End If
  215.         End If
  216.     Next x
  217.     For x = 1 To SQL.Groups.Count
  218.         If SQL.Groups.Item(x).Name = txtGroup(NumGroups - 1).Text Then
  219.             SQL.Groups.Remove x
  220.         End If
  221.     Next x
  222.     txtFields.Left = txtFields.Left - 200
  223.     txtFields.Width = txtFields.Width + 200
  224.     If NumGroups - 1 > 0 Then
  225.         txtFields.Top = txtGroup(NumGroups - 2).Top + txtGroup(NumGroups - 2).Height + 30
  226.     Else
  227.         txtFields.Top = txtGroup(NumGroups - 1).Top
  228.     End If
  229.     txtFields.Height = txtFields.Height + txtGroup(NumGroups - 1).Height
  230.         
  231.     If NumGroups - 1 > 0 Then
  232.         Unload txtGroup(NumGroups - 1)
  233.     Else
  234.         txtGroup(NumGroups - 1).Visible = False
  235.     End If
  236.         
  237.     NumGroups = NumGroups - 1
  238. End Sub
  239. Private Sub Form_Load()
  240.     Dim NumFields As Integer
  241.     Dim FieldList As String
  242.     NumGroups = 0
  243.     ' Move the all selected fields from previous tab to the field list.
  244.     For NumFields = 0 To SelectFields.lstSelectedFields.ListCount - 1
  245.         SelectFields.lstSelectedFields.ListIndex = NumFields
  246.         lstFields.AddItem SelectFields.lstSelectedFields.Text
  247.         
  248.         FieldList = FieldList & SelectFields.lstSelectedFields.Text & ", "
  249.     Next NumFields
  250.     FieldList = Left(FieldList, Len(FieldList) - 2)
  251.     txtFields.Text = FieldList
  252. End Sub
  253. Private Sub lstFields_DblClick()
  254.     Call AddGroup
  255. End Sub
  256. Private Sub txtGroup_GotFocus(Index As Integer)
  257.     ' Change all groups to be non bold text.
  258.     For x = 0 To NumGroups - 1
  259.         txtGroup(x).FontBold = False
  260.     Next x
  261.     ' Change the group that has focus to be bold.
  262.     txtGroup(Index).FontBold = True
  263. End Sub
  264. Public Sub AddGroup()
  265.     Dim x As Integer
  266.     NumGroups = NumGroups + 1
  267.     If NumGroups > 1 Then
  268.         Load txtGroup(NumGroups - 1)
  269.         txtGroup(NumGroups - 1).Left = txtGroup(NumGroups - 2).Left + 200
  270.         txtGroup(NumGroups - 1).Width = txtGroup(NumGroups - 2).Width - 200
  271.         txtGroup(NumGroups - 1).Top = txtGroup(NumGroups - 2).Top + txtGroup(NumGroups - 2).Height + 30
  272.         txtGroup(NumGroups - 1).Height = txtGroup(NumGroups - 2).Height
  273.         txtGroup(NumGroups - 1).ZOrder 0
  274.     End If
  275.     For x = 0 To NumGroups - 1
  276.         txtGroup(x).FontBold = False
  277.     Next x
  278.     txtGroup(NumGroups - 1).Visible = True
  279.     txtGroup(NumGroups - 1).Text = lstFields.Text
  280.     txtGroup(NumGroups - 1).FontBold = True
  281.     txtFields.Left = txtFields.Left + 200
  282.     txtFields.Width = txtFields.Width - 200
  283.     txtFields.Top = txtGroup(NumGroups - 1).Top + txtGroup(NumGroups - 1).Height + 30
  284.     txtFields.Height = txtFields.Height - txtGroup(NumGroups - 1).Height
  285.     SQL.Groups.Add lstFields.Text, lstFields.Text
  286. End Sub
  287.